package com.spa.application.command.member;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.spa.infrastructure.util.UrlUtil;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.util.Date;

@Data
public class MemberUserInfoEditCommand {

    @NotBlank(message = "ID必传")
    private String id;

    private String name;

    @Past(message = "请正确填写出生日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    @NotBlank(message = "头像不能为空！")
    private String avatar;

    public void setAvatar(String avatar) {
        this.avatar = UrlUtil.handleUrl(avatar, ",");;
    }

}
